//
//  OpenDashboard.m
//  
//
//  Created by caiyao on 12/1/15.
//
//

#import "OpenDashboard.h"
#import "AppDelegate.h"
#import "VideoPlaybackViewController.h"
#import "ShareData.h"
#import "Config.h"

@implementation OpenDashboard

- (void)openDashboard:(CDVInvokedUrlCommand*)command {
    Config *config = [[ShareData shareInstance] getConfig];
    NSString *dashboardAppURL = config.dashboardAppSchema;
//    NSString *dashboardAppURL = @"com.dashboards://";
    NSString *dashboardAppStoreURL = config.dashboardAppStoreURL;
    if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:dashboardAppURL]]) {
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:dashboardAppURL]];
    } else {
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:dashboardAppStoreURL]];
    }
}

@end
